package com.yeyuanqi.hottop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeyuanqi.hottop.entity.SysWeb;
import com.yeyuanqi.hottop.entity.TJinrihot;
import com.yeyuanqi.hottop.mapper.SysWebMapper;
import com.yeyuanqi.hottop.mapper.TJinrihotMapper;
import com.yeyuanqi.hottop.service.TJinrihotService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeyuanqi.hottop.vo.HotListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yeyuanqi
 * @since 2021-12-22
 */
@Service
public class TJinrihotServiceImpl extends ServiceImpl<TJinrihotMapper, TJinrihot> implements TJinrihotService {

    @Autowired
    private TJinrihotMapper tJinrihotMapper;

    @Autowired
    SysWebMapper sysWebMapper;

    //查询最新的热搜
    @Override
    public List<HotListVO> selectNewHot() {
        List<HotListVO> newlist = tJinrihotMapper.selectNewHot();
        //反转列表
        Collections.reverse(newlist);
        return newlist;
    }

    //根据日期或者时间查询热搜
    @Override
    public List<HotListVO> selectHotByTime(String day, String min) {
        List<HotListVO> tJinrihots = tJinrihotMapper.selectHotByTime(day, min);
        return tJinrihots;
    }
}
